<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" th:href="@{/admin/bootstrap4/css/bootstrap.css}">
    <script th:src="@{/admin/bootstrap4/js/jquery-3.3.1.min.js}"></script>
    <script th:src="@{/admin/bootstrap4/js/bootstrap.js}"></script>

</head>

<body>
<br>
<div style="width:80%;height: 600px;margin-left:10% ;">

    <table class="table">
        <thead class="bg-dark" style="color: white">
        <tr>
            <th scope="col">文章ID</th>
            <th scope="col">文章标题</th>
            <th scope="col">文章内容</th>
            <th scope="col">发帖人</th>
            <th scope="col">文章分类</th>
            <th scope="col">提交时间</th>
            <th scope="col">状态</th>
            <th scope="col">审核</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="article:${articleList}" >
            <th scope="row">[[${article.articleId}]]</th>
            <td>[[${#strings.abbreviate(article.articleTitle,10)}]]</td>
            <td>[[${#strings.abbreviate(article.articleContent,10)}]]</td>
            <td>[[${article.userName}]]</td>
            <td>[[${article.aTypeName}]]</td>
            <td th:text="${#dates.format(article.articleTime,'yyyy-MM-dd HH:mm')}"></td>
            <td>
                <span class="badge badge-danger" th:if="${article.articleState == 0}">待审核</span></td>
            </td>
            <td>
                <a type="button" class="btn btn-info btn-sm" th:href="@{/admin/findArticleDetailById(articleId=${article.articleId},currentIndex=${currentIndex},flag=false)}">查看</a>
                <a type="button" class="btn btn-success btn-sm" th:href="@{/admin/checkSuccess(articleid=${article.articleId})}">通过</a>
                <a type="button" class="btn btn-danger btn-sm" th:href="@{/admin/checkFail(articleid=${article.articleId})}">拒绝</a>
            </td>
        </tr>
        </tbody>
    </table>
    <nav aria-label="Page navigation example">
        <ul class="pagination">
            <li class="page-item">
                <a class="page-link" th:href="@{/admin/checkArticle(currentIndex=${currentIndex-1})}" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <li class="page-item"><a class="page-link" href="#">第[[${currentIndex}]]页</a></li>
            <li class="page-item"><a class="page-link" href="#">共[[${page.getPages()}]]页</a></li>
            <li class="page-item">
                <a class="page-link" th:href="@{/admin/checkArticle(currentIndex=${currentIndex+1})}" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
        </ul>
    </nav>

    <!-- 文件信息展示-弹窗 -->
    <div class="modal fade" id="ModalId" tabindex="-1" role="dialog"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">修改用户信息</h4>
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×</button>
                </div>
                <div class="modal-body">
                    <!-- 内容主体begin -->
                    <form id="myform" th:action="@{/admin/modUser}" method="post">
                        <input type="hidden" name="userid">
                        <input type="hidden" name="currentindex">
                        <div class="input-group input-group-sm mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text" id="inputGroup-sizing-sm">用户账户</span>
                            </div>
                            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" name="username">
                        </div>
                        <div class="input-group input-group-sm mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">用户密码</span>
                            </div>
                            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" name="userpassword">
                        </div>
                        <div class="input-group input-group-sm mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">用户昵称</span>
                            </div>
                            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" name="usernickname">
                        </div>
                        <div class="input-group input-group-sm mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">用户邮箱</span>
                            </div>
                            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" name="useremail">
                        </div>
                        <div class="input-group input-group-sm mb-3">
                            <div class="input-group-prepend">
                                <span class="input-group-text">用户电话</span>
                            </div>
                            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" name="userphone">
                        </div>
                    </form>
                    <!-- 内容主体end -->
                </div>
                <div class="modal-footer">
                    <button form="myform" type="submit" class="btn btn-primary" id="ModalYesId">提交</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
</html>